<% if is_admin? then%>
	<h1>Liste des utilisateurs</h1>
<% else%>
	<h1>Mon profil</h1>
<% end %>
<table>
    <tr>
        <th class="bddRender">
            Pays
        </th>
        <th class="bddRender">
            Nom
        </th>
        <th class="bddRender">
            Prénom
        </th>
        <th class="bddRender">
            Email
        </th>
        <% if is_admin? then %>
        <th class="bddRender">
            Date de naissance
        </th>
        <th class="bddRender">
            Localité
        </th>
        <th class="bddRender">
            Niveau de sécurité
        </th>
        <th class="bddRenderAdmin">
            &nbsp;
        </th>
        <th class="bddRenderAdmin">
            &nbsp;
        </th>
        <% end %>
    </tr>
    <% @users.each do |user|
    printLand = "inconnu";
    @lands.each do |land|
    if land.id == user.land_id then
    printLand = land.name;
    end
    end %>
    <tr>
        <td>
            <%=h printLand %>
        </td>
        <td>
            <%=h user.last_name %>
        </td>
        <td>
            <%=h user.first_name %>
        </td>
        <td>
            <%=h user.email %>
        </td>
        <% if is_admin? then %>
        <td>
            <%=h user.birthday.day.to_s + "." +user.birthday.month.to_s + "." +user.birthday.year.to_s %>
        </td>
        <td>
            <%=h user.locality %>
        </td>
        <td>
            <%=h user.security_level %>
        </td>
        <td>
            <%= link_to 'Editer', edit_user_path(user) %>
        </td>
        <td>
            <%= link_to 'Supprimer', user, :confirm => 'Etes-vous sûr?', :method => :delete %>
        </td>
        <% end %>
    </tr>
    <% end %>
</table>
<br/>
<%= link_to 'Nouvel utilisateur', new_user_path if is_admin? %>
<%= link_to 'Editer Mon profil', edit_user_path(current_user.id) %>
